package com.biz.primus.model.cart.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.List;

import static com.google.common.collect.Lists.newArrayList;

/**
 * 购物车组vo
 *
 * @author lei
 * @date 2017/01/13
 */
@Getter
@Setter
@ApiModel("购物车组vo")
public class ShopCartBundleVo implements Comparable<ShopCartBundleVo>, Serializable {

    private static final long serialVersionUID = 8871493630123755432L;

    /**
     * 排序
     */
    @ApiModelProperty("排序")
    private int idx = 0;

    /**
     * 显示标题
     */
    @ApiModelProperty("显示标题")
    private String title;

    /**
     * 购物车明细列表
     */
    @ApiModelProperty("购物车明细列表")
    private List<ShopCartItemVo> items = newArrayList();

    /**
     * 总价格
     */
    @ApiModelProperty("总价格")
    private int totalPrice;

    /**
     * 选中数量
     */
    @ApiModelProperty("选中数量")
    private int selectedAmount;

    /**
     * 总数量
     */
    @ApiModelProperty("总数量")
    private int totalAmount;

    @Override
    public int compareTo(ShopCartBundleVo o) {
        if (o == null) {
            return 1;
        }
        return o.getIdx() - this.getIdx();
    }
}
